<html>

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
  <link rel="stylesheet" title="Default" href="http://acm.math.spbu.ru/~sk1/colorer/my.css">

  <script src="http://acm.math.spbu.ru/~sk1/colorer/highlight.js"></script>
  <script src="http://acm.math.spbu.ru/~sk1/colorer/cpp.js"></script>
  <script>hljs.initHighlightingOnLoad();</script>
</head>

<body>

<pre><code>
import java.io.*;
import java.util.*;

public class avl_as implements Runnable {
    final static long P = 786433;

    final static long G = 10;
    final static long invG = 235930;

    final static long inv2 = 393217;

    int s;
    int[] rev;

    long pow(long a, long b) {
        long r = 1;
        while (b &gt; 0) {
            if ((b & 1) != 0) {
                r = (r * a) % P;
            }
            b /= 2;
            a = (a * a) % P;
        }
        return r;
    }

    void step(long[] a, long[] b, int k, boolean inv) {
        int m = s &gt;&gt; k;
        long r = 1;
        long gg;
        if (!inv) {
            gg = pow(G, (P - 1) / (1 &lt;&lt; k));
        } else {
            gg = pow(invG, (P - 1) / (1 &lt;&lt; k));
        }

        int h = s / 2;
        for (int i = 0; i &lt; h; i++) {
            long v = (a[2 * i + 1] * r) % P;
            b[i] = (a[2 * i] + v) % P;
            b[i + h] = (a[2 * i] - v + P) % P;
            if (i % m == m - 1) {
                r = (r * gg) % P;
            }
        }
    }

    void fft(long[] a, long[] b, int l, boolean inv) {
        long[] t = new long[s];
        for (int i = 0; i &lt; s; i++) {
            t[rev[i]] = a[i];
        }
        for (int i = 1; i &lt;= l; i++) {
            step(t, b, i, inv);
            System.arraycopy(b, 0, t, 0, s);
        }
    }

    void slowft(long[] a, long[] b, int l, boolean rev) {
        long gg = 1;
        long g;
        if (!rev) {
            g = pow(G, (P - 1) / (1 &lt;&lt; l));
        } else {
            g = pow(invG, (P - 1) / (1 &lt;&lt; l));
        }
        for (int i = 0; i &lt; s; i++) {
            long v = 0;
            for (int j = 0; j &lt; s; j++) {
                v = (v * gg + a[s - j - 1]) % P;
            }
            b[i] = v;
            gg = (gg * g) % P;
        }
    }

    public void solve() throws IOException {
    	Scanner in = new Scanner(new File("avl.in"));
    	PrintWriter out = new PrintWriter(new File("avl.out"));

	    int n = in.nextInt();
        int h = in.nextInt() + 1;

        s = 1 &lt;&lt; h;

        if (n &gt;= s) {
        	out.println(0);
        	out.close();
        	return;
        }

        rev = new int [s];
        for (int q = 1; q &lt; s; q &lt;&lt;= 1) {
            for (int i = 0; i &lt; q; i++) {
                rev[i] &lt;&lt;= 1;
                rev[i + q] = rev[i] + 1;
            }
        }

        long[] b = new long[s];

        long[] c = new long[s];
        Arrays.fill(c, 1L);

        long[] d = new long[s];
        long g = pow(G, (P - 1) / (1 &lt;&lt; h));
        long gg = 1L;
        for (int j = 0; j &lt; s; j++) {
            d[j] = gg;
            gg = (gg * g) % P;
        }

        for (int i = 2; i &lt;= h; i++) {
            System.out.println(i);
            long[] t = b;
            b = c;
            c = d;
            d = t;
            gg = 1;
            for (int j = 0; j &lt; s; j++) {
                d[j] = (c[j] * c[j] + 2 * b[j] * c[j]) % P;
                d[j] = (d[j] * gg) % P;
                gg = (gg * g) % P;
            }
        }
        long[] a = new long[s];
        fft(d, a, h, true);

        long q = pow(inv2, h);
        for (int i = 0; i &lt; s; i++) {
            a[i] = (a[i] * q) % P;
        }

        out.println(a[n]);

        out.close();
    }

    static void findGenerator() {
        ArrayList&lt;Long&gt; pm1a = new ArrayList&lt;Long&gt;();
        long  p = P - 1;
        for (long i = 2; i &lt; P; i++) {
            if (p % i == 0) {
                pm1a.add((P - 1) / i);
                while (p % i == 0) {
                    p /= i;
                }
            }
        }

        long g = 2;
        while (true) {
            boolean ok = true;
            for (long x : pm1a) {
                long r = 1;
                for (int i = 0; i &lt; x; i++) {
                    r = (r * g) % P;
                }
                if (r == 1) {
                    ok = false;
                    break;
                }
            }
            if (ok) {
                break;
            }
            g++;
        }

        long ig = 1;
        for (int i = 0; i &lt; P - 2; i++) {
            ig = (ig * g) % P;
        }

        System.out.println("Generator found: " + g);
        System.out.println("Inverse generator: " + ig);

        long j = 1;
        long prev = 0;
        for (int i = 0; i &lt; P - 1; i++) {
            prev = j;
            j = (j * 2) % P;
            if (j == 1) {
                System.out.println("Order of 2 is " + (i + 1));
                System.out.println("2^-1 = " + prev);
                break;
            }
        }
    }

    public void run() {
        try {
            solve();
        } catch (IOException e) {
            System.exit(64);
        }
    }

    public static void main(String[] arg) throws IOException {
//        findGenerator();
        new Thread(new avl_as()).start();
    }
}
</code></pre>

</body>
</html>

<font style="visibility:hidden">
